/*
 * sockselect.h
 *
 *  Created on: 2012-5-26
 *      Author: epmm
 */

#ifndef SOCKSELECT_H_
#define SOCKSELECT_H_
#include <vector>
#include <string>
#include <iostream>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <string.h>

#define LOG_PRINT_DEBUG(string) std::cout<<string<<std::endl;

#define SOCK_RECVBUFSIZE 8096

int CreateSocket();
int Bind(int listenSock, int port, const char* ip = NULL);
int Listen(int listenSock, int backlog);
int Initfdset(int listenSock, fd_set* readset, int* fds,size_t size);
int Select(int maxfd, fd_set* readfds, fd_set* writefds, fd_set* exceptfds);
int Accept(int listenfd, fd_set* readset, int* clientfd,sockaddr_in* clientaddr);
int Recv(int fds, fd_set* readset, int nFlags ,std::string& strRecvBuf);


#endif /* SOCKSELECT_H_ */
